package com.czxy.service;

import com.czxy.dao.UserMapper;
import com.czxy.domain.User;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;


@Service
@Transactional

public class UserServiceImpl implements  UserService {


    @Resource
    private UserMapper userMapper;



    @Override
    public List<User> findAll() {
        return userMapper.selectAll();
    }

    @Override
    public List<User> findById(Integer uid) {
        return userMapper.selectByExample(uid);
    }

    @Override
    public void add(User user) {

        userMapper.insert(user);
    }

    @Override
    public void updateById(User user) {
        userMapper.updateByPrimaryKey(user);

    }

    @Override
    public void del(Integer uid) {

        userMapper.deleteByPrimaryKey(uid);

    }


}
